package ogdkp.om;

import java.util.Collections;
import java.util.List;

public class Loot implements ITreeNode {

	private final ITreeNode parent;

	private String name;

	private final long timestamp;

	private int cost;

	public Loot(final ITreeNode parent, final String name, final int cost) {
		this.parent = parent;
		this.name = name;
		this.cost = cost;
		timestamp = System.currentTimeMillis();
	}

	public String getName() {
		return name;
	}

	public int getCost() {
		return cost;
	}

	public long getTimestamp() {
		return timestamp;
	}

	@Override
	public ITreeNode getParent() {
		return parent;
	}

	@Override
	public List<ITreeNode> getChildren() {
		return Collections.emptyList();
	}

	public void removeFromParent() {
		if (parent instanceof Player) {
			((Player) parent).removeLoot(this);
		}

	}

	public void setName(final String name) {
		this.name = name;

	}

	public void setCost(final int cost) {
		this.cost = cost;
	}

}
